package com.hanggold.springboot.lesson3.controller;

import com.hanggold.springboot.lesson3.req.UserReq;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author smc
 * @date 2019-06-24 15:34
 * @since
 **/
@Controller
@RequestMapping("validate")
public class ValidateController {

//    /**
//     * {@link RequestMapping}
//     * @since 4.2
//     * @see  #user(UserReq)
//     */
//    @RequestMapping(value = "user",method = RequestMethod.POST)
//    public Object user(@Validated  @RequestBody  UserReq userReq){
//        return userReq;
//    }

    @RequestMapping(value = {"user/form","user/name"},method = RequestMethod.GET)
    @ResponseBody
    public Object userForm(UserReq userReq,String id,String name){
        return userReq;
    }

//    @RequestMapping(value = "user/form1",method = RequestMethod.GET)
//    public Object userForm1(@ModelAttribute UserReq userReq){
//        return userReq;
//    }

//    @GetMapping("attr")
//    @ModelAttribute
//    public Object attr(){
//        return "";
//    }
//
//    @ModelAttribute
//    public Object baseAttr(String name,int age){
//        System.out.println("attrName: "+ name+" ,age: "+ age);
//        return "hh";
//    }




}
